import * as React from 'react';
import { BrowserRouter as Router,withRouter,RouteComponentProps, Route, Switch, Redirect } from 'react-router-dom'
// import createBrowserHistory from 'history/createBrowserHistory';


//按需加载 路由插件
// import asyncComponent from './asyncComponent'

//按需加载的组件
let Home = React.lazy(() => import('../pages/home/home'));




//生成一个实例对象 历史记录什么的
// const history = createBrowserHistory();

//加载的过渡动画
let Loading =()=>{
  return (
    <div>{/* loading */}</div>
  )
}

class RouterMap extends React.Component {
  render() {
    return (
      // <Router history={history}>
      <Router basename="/didi">
        <Switch>
            <React.Suspense fallback={<Loading/>}>
              <Route exact path="/" component={Home} />
              {/* <Redirect to="/" /> */}
            </React.Suspense>

        </Switch>
      </Router>
    );
  }
}

//返回了 connect 其实是一个容器组件
export default RouterMap; 
